folder B: Renaming considerations if the path name is the same, it is renamed. If the path name is different, it is renamed and clipped. C: Delete Note: Delete in Java does not go to the Recycle Bin. To delete a folder, note that the folder cannot contain files or Folders file class (the function of the file Class) A: Judge function public boolean isdirector
1. Store the data in the collection into a text file case:Requirement: To store string data in the ArrayList collection into a text file?(1) Analysis:Through the meaning of the topic, we can know some of the following things,A string is stored in the ArrayList collection.Traverse the ArrayList collection to get the data.It is then stored in a text file.The text file
1. Randomly get name cases in a text fileRequirements: I have a text file stored in a few names, please write a program implementation randomly get a person's name.Analysis:A: Storing the data in a text file in a collectionB: Randomly produce an indexC: Gets a value based on the index2. Code implementation:1 Packagecn.itcast_02;2 3 ImportJava.io.BufferedReader;4 ImportJava.io.FileReader;5 Importjava.io.IOE
NIO and IO in the java file system, and nioio in the java File System
Java introduced the java NIO mechanism since jdk1.4:
The notable features of NIO are channel, buffer, selector ), n
Blog from: http://blog.csdn.net/amosryan/article/details/6568783
Function directory: Convert input stream to byte stream read the file as a string to specify the encoding format to place the input stream into a list
Source:[Java] View Plain copy print? packageamosryan.utility.file; importjava.io.bufferedreader; importjava.io.bytearrayoutputstream; importjava.io.file; import java.io.fileinputstream; import
ioexception
Normal
Create a new file
Public Boolean exists ()
Normal
Determine whether a file exists
Public Boolean Delete ()
Normal
Delete an object
Public Boolean isdirectory ()
Normal
Determines whether the specified path is a directory.
Public long length ()
Normal
Size of the returned File
The file IO in Java7 has changed a lot and has introduced many new classes specifically:Import Java.nio.file.DirectoryStream;Import Java.nio.file.FileSystem;Import Java.nio.file.FileSystems;Import Java.nio.file.Files;Import Java.nio.file.Path;Import java.nio.file.Paths;Import Java.nio.file.attribute.FileAttribute;Import java.nio.file.attribute.PosixFilePermission;Import java.nio.file.attribute.PosixFilePerm
[Java iO] _ file class notes
Objectives of this chapter:
Measure the test taker's knowledge about the functions of the file class.You can use methods in the file class to operate files.
File class
In the entire
fullFwriter.Close();//Close FileWriter object //Read fileFileReader Freader =NewFileReader (file);Char[] CS2 =New Char[ the]; Freader.Read(CS2);//This is not read by the while loop because it knows the length is not greater than 15 for(CharC:CS2) {//Traversal outputSystem. out.Print(c); } freader.Close();Operation Result:i love javaReference1. Java Stream (stream),
Existing requirements, a designated PPT of the desktop according to the size of 1MB to cut, will cut out the files and configuration files in a directoryImportJava.io.File;ImportJava.io.FileInputStream;Importjava.io.FileNotFoundException;ImportJava.io.FileOutputStream;Importjava.io.IOException;Importjava.util.Properties; Public classTest { Public Static voidMain (string[] args)throwsIOException {File file=N
The use of the file class in the JAVAI/O section of the Java---(note)In Java, I/O (input/output) is a tedious thing, because I do not see the obvious effect, but the input/output is a necessary part of all programs-using the input mechanism, allowing the program to read external data (including data from disk, CD and other storage devices), user input data, using
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.